const express = require('express')
const expressJoi = require('@escook/express-joi')

const { getCate, addCate, deleteCateById, getCateById, updateCateById } = require('../router_handler/cate')

const router = express.Router()

const { addCateRuler, deleteCateByIdRuler, getCateByIdRuler, updateCateByIdRuler } = require('../schema/cate')
    //挂载文章分类列表
router.get('/article/cates', getCate)

//挂载新增文章分类列表
router.post('/article/addcates', expressJoi(addCateRuler), addCate)

//挂载根据Id删除文章分类
router.get('/article/deletecate/:id', expressJoi(deleteCateByIdRuler), deleteCateById)

//挂载根据Id获取文章分类数据
router.get('/article/cates/:id', expressJoi(getCateByIdRuler), getCateById)

//挂载根据Id更新文章分类数据
router.post('/article/updatecate', expressJoi(updateCateByIdRuler), updateCateById)

module.exports = router